using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class peng : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }

    void OnTriggerEnter2D(Collider2D other)
    {
        moveControll pc = other.GetComponent<moveControll>();
        if (pc != null)
        {
            Debug.Log("玩家吃到血包");
            if (pc.CurrentHealth < pc.MaxHealth)
            {
                
                pc.pullHealth(1);
                Debug.Log("当前血量/最大血量: " + pc.CurrentHealth + "/" + pc.MaxHealth);

            }
            gameObject.SetActive(false);

            //Destroy(this.gameObject);
        }
    }
}
